const noop = () => {
};

/* eslint-disable */
module.exports = function (redisClient, module) {
    const helpers = module.helpers.redis;

    module.sortedSetRemove = function (key, value, callback = noop) {
        if (!value) {
            return callback();
        }
        if (!Array.isArray(value)) {
            value = [value];
        }

        helpers.multiKeyValues(redisClient, 'zrem', key, value, (err) => {
            callback(err);
        });
    };

    module.sortedSetsRemove = function (keys, value, callback) {
        helpers.multiKeysValue(redisClient, 'zrem', keys, value, (err) => {
            callback(err);
        });
    };

    module.sortedSetsRemoveRangeByScore = function (keys, min, max, callback = noop) {
        const multi = redisClient.multi();
        for (let i = 0; i < keys.length; i += 1) {
            multi.zremrangebyscore(keys[i], min, max);
        }
        multi.exec(callback);
    };
};
/* eslint-enable */
